package com.cennavi.minemap.util;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

import com.alibaba.fastjson.JSONObject;
import com.vividsolutions.jts.geom.Geometry;


public class ParseUploadFileUtil {
	
	public void parse(String file) throws IOException{
		FileReader fr = new FileReader(file);  
		BufferedReader bufferedreader = new BufferedReader(fr);
		String line;  
		while ((line = bufferedreader.readLine()) != null) {  
            if (0 != line.length()) {
            	JSONObject json = JSONObject.parseObject(line.trim());
            	
            	String geometry = json.getJSONObject("geometry").toJSONString();
            	
            	Geometry geom = GeoUtil.readGeojson(geometry);
            	
            	GeoUtil.geometry2WKB(geom);
            	
            	System.out.println(geom.toString());
            }  
        }  
        fr.close(); 
	}
}
